package org.sage.sdk.dada.order.entity;

import lombok.Data;
import org.sage.sdk.dada.infrastructure.common.BaseEntity;
import org.sage.sdk.dada.infrastructure.common.attributes.OrderId;
import org.sage.sdk.dada.infrastructure.utils.GetBodyUtil;

import javax.validation.constraints.NotNull;

/**
 * 取消追加订单
 * <p>
 * 商户调用该接口取消已发布的追加订单,接口URL地址：/api/order/appoint/cancel
 * <p>
 * 被取消的追加订单，状态变为待接单，其他配送员可见
 *
 * @author 周广明
 * @version v1 2019/12/10 下午7:20
 */
@Data
public class CancelAdditionalOrder implements BaseEntity {

    @Override
    public String getUrl() {
        return "/api/order/appoint/cancel";
    }

    @Override
    public String getBody() {
        return GetBodyUtil.toJsonStr(this);
    }

    public CancelAdditionalOrder(OrderId orderId) {
        this.orderId = orderId;
    }

    @NotNull
    OrderId orderId;
}
